<template>
  <div class="host">
    <van-search
      v-model="search"
      shape="round"
      background="#4fc08d"
      placeholder="请输入店铺/商品"
      @click="clickTo()"
    />
    <van-swipe
      v-if="swiper.length"
      class="my-swipe"
      :autoplay="1000"
      indicator-color="white"
    >
      <van-swipe-item v-for="(item, index) in swiper" :key="index">
        <img :src="item.bannerUrl" alt="" />
      </van-swipe-item>
    </van-swipe>
    <van-skeleton class="skeleton" v-else title title-width="100%" :row="3" />
    <div class="title">猜你喜欢</div>
    <ul>
      <!-- <li  v-for="(item,index) in uls" :key="index" >{{item.lis}}</li> -->
      <li>综合排序</li>
      <li>距离最近</li>
      <li>销量最高</li>
      <li>筛选</li>
    </ul>
    <div class="mach" v-if="muches.length">
      <span class="tem" v-for="(item, index) in muches" :key="index">{{
        item.mas
      }}</span>
    </div>
    <van-skeleton class="skeleton" v-else title title-width="100%" :row="3" />

    <div class="nood" v-if="match.length">
      <div
        @click="toMore(item.mtWmPoiId)"
        class="goods"
        v-for="(item, index) in match"
        :key="index"
      >
        <img :src="item.picUrl" alt="" />
        <div class="left">
          <h3>{{ item.name }}</h3>
          <div class="top">
            <span class="love">{{ item.averagePriceTip }}</span>
            <span class="sell"> {{ item.monthSalesTip }}</span>
          </div>
          <div class="two">
            <span class="send">{{ item.minPriceTip }}</span>
            <span class="mend">{{ item.shippingFeeTip }}</span>
            <span class="center">{{ item.deliveryTimeTip }}</span>
            <span class="miter">{{ item.distance }}</span>
          </div>
        </div>
      </div>
    </div>
    <van-skeleton class="skeleton" v-else title title-width="100%" :row="9" />
  </div>
</template>

<script>
import { swiper_list, shop_list } from "../../api";
export default {
  data() {
    return {
      search: "",
      swiper: [],
      match: "",
      muches: [
        { mas: "年货节热卖" },
        { mas: "津贴联盟" },
        { mas: "满减优惠" },
        { mas: "品质联盟" },
      ],
    };
  },
  mounted() {
    swiper_list().then((res) => {
      this.swiper = res.data.list;
    });
    shop_list({ status: 0 }).then((res) => {
      console.log(res.data.list);
      this.match = res.data.list;
    });
  },
  methods: {
    toMore(id) {
      this.$router.push("/more/" + id);
    },
    clickTo(){
      this.$router.push('/search')
    }
  },
};
</script>

<style scoped>
.my-swipe {
  margin: 10px;
  border-radius: 10px;
}
.my-swipe img {
  width: 100%;
  border-radius: 10px;
}
.title {
  font-weight: bolder;
  height: 25px;
  line-height: 20px;
}
ul {
  height: 30px;
  margin: auto;
  display: flex;
  justify-content: space-between;
}
.mach {
  width: 100%;
  height: 30px;
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
}
h3 {
  font-size: 14px;
}
.tem {
  width: 24%;
  height: 100%;
  background-color: #ccc;
  text-align: center;
  /* line-height: 30px; */
}
.nood {
  width: 100%;
  height: 100px;
  /* border-bottom: 1px solid #000; */
}
.goods {
  width: 100%;
  height: 100%;
  display: flex;
  margin-top: 5px;
}
img {
  display: block;
  width: 70px;
  height: 70px;
}
.love {
  color: yellow;
}
.sell {
  display: inline-block;
  margin-left: 20px;
}
.send,
.mend,
.center {
  display: inline-block;
  margin-right: 5px;
}
.top {
  margin-top: 0px;
}
</style>